﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Pipes.Queries
{
  public static class Utils
  {
    public static bool ListEquals<T>(IList<T> x, IList<T> y)
    {
      if (x.Count == y.Count)
      {
        return x.Intersect(y).Count() == x.Count;
      }
      return false;
    }

    public static bool TryGetValue<S, T2, T>(IDictionary<S, T2> dict, S search, out T result) where T2 : T
    {
      T2 tempResult = default(T2);
      if (dict.TryGetValue(search, out tempResult))
      {
        result = (T)tempResult;
        return true;
      }
      else
      {
        result = default(T);
        return false;
      }
    }
  }
}
